import { ResPage, ResultData, Elderly, CareRecord } from "@/api/interface/index";
import { PORT_Elderly, PORT_CareRecord } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 老人信息管理模块
 */
// 获取老人列表
export const getElderlyInfoList = (params: Elderly.ReqElderlyInfoParams) => {
  return http.post<ResPage<Elderly.ResElderlyInfoList>>(PORT_Elderly + `/list`, params);
};

// 保存老人信息
export const saveElderlyInfo = (params: Elderly.ReqElderlyInfoSaveParams) => {
  return http.post<ResultData<number>>(PORT_Elderly + `/save`, params);
};

// 删除老人信息
export const deleteElderlyInfo = (params: Elderly.ReqElderlyInfoDeleteParams) => {
  return http.post<ResultData<boolean>>(PORT_Elderly + `/delete`, params);
};

// 设置老人状态
export const setElderlyInfoStatus = (params: Elderly.ReqElderlyInfoStatusParams) => {
  return http.post<ResultData<boolean>>(PORT_Elderly + `/set-status`, params);
};

// 保存老人照护计划
export const saveElderlyCarePlan = (params: Elderly.ReqSaveElderlyCarePlanInput) => {
  return http.post<boolean>(PORT_Elderly + `/save-care-plan`, params);
};

// 获取老人照护计划动作列表
export const getElderlyCarePlanMissionList = (elderlyId: number) => {
  return http.get<Elderly.ElderlyCarePlanMissionDto[]>(PORT_Elderly + `/care-plan?elderlyId=${elderlyId}`);
};

// 获取老人照护记录列表
export const getElderlyCareRecordList = (params: CareRecord.ReqElderlyCareRecordListInput) => {
  return http.post<ResPage<CareRecord.ResElderlyCareRecordDto>>(PORT_CareRecord + `/care-record-list`, params);
};
